#include <bits/stdc++.h>
using namespace std;
#define int long long
char buf[1<<23],*p1=buf,*p2=buf,obuf[1<<23],*O=obuf;
#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-') f=-1;ch=getchar();}
    while(isdigit(ch)) x=x*10+(ch^48),ch=getchar();
    return x*f;
}
int T,n,ans;
int get(int x,int y){
    if(x*y==n) return x+y+1;
    int m=abs(n-x*y),ans=x+y+1;
    if(m>x) return 2e18;
    if(x&1){
        if(m&1) ans++;
        else ans+=2;
    }
    else{
        if(m&1) return 2e18;
        else ans++;
    }
    return ans;
}
void solve(){
    n=read(),ans=2e18;
    if(n==0){
        cout<<"2\n";
        return;
    }
    for(int i=max((int)sqrtl(n)-100,1ll);i<=min((int)sqrtl(n)+100,n);i++){
        ans=min(ans,min(get(i,n/i),get(i,n/i+1)));
    }
    cout<<ans<<"\n";
}
signed main(){
    freopen("tree.in","r",stdin);
    freopen("tree.out","w",stdout);
    T=read();
    while(T--) solve();
    return 0;
}